package text;
public class TestAnonymousInnerClass {
        public void test1(A a){
            a.run();
        }
        public  void main(String[] args) {
            TestAnonymousInnerClass tac = new TestAnonymousInnerClass();
            tac.test1(new A(){
                @Override
                public void run() {
                    System.out.println("定义的第一个匿名内部类");
                }
            });
            tac.test1(new A(){
                @Override
                public void run() {
                    System.out.println("定义的第二个内部类");
                }
            });
        }
    }
    interface A {
        void run();
    }

